/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package sp.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Thosan Girisona S
 */
@Entity
@Table(name = "sisipan")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Sisipan.findAll", query = "SELECT s FROM Sisipan s"),
    @NamedQuery(name = "Sisipan.findByNksSisipan", query = "SELECT s FROM Sisipan s WHERE s.nksSisipan = :nksSisipan"),
    @NamedQuery(name = "Sisipan.findByPertanyaan3b", query = "SELECT s FROM Sisipan s WHERE s.pertanyaan3b = :pertanyaan3b")})
public class Sisipan implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "nks_sisipan")
    private String nksSisipan;
    @Lob
    @Column(name = "pertanyaan1")
    private String pertanyaan1;
    @Column(name = "pertanyaan3b")
    private String pertanyaan3b;
    @JoinColumn(name = "nks_sisipan", referencedColumnName = "nks", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private B1 b1;
    @JoinColumn(name = "pertanyaan2", referencedColumnName = "Kode")
    @ManyToOne(optional = false)
    private OptionYaTidak pertanyaan2;
    @JoinColumn(name = "pertanyaan3a", referencedColumnName = "Kode")
    @ManyToOne(optional = false)
    private OptionPertanyaan3a pertanyaan3a;
    @JoinColumn(name = "klasifikasi", referencedColumnName = "kode")
    @ManyToOne(optional = false)
    private OptionKlasifikasi klasifikasi;

    public Sisipan() {
    }

    public Sisipan(String nksSisipan) {
        this.nksSisipan = nksSisipan;
    }

    public String getNksSisipan() {
        return nksSisipan;
    }

    public void setNksSisipan(String nksSisipan) {
        this.nksSisipan = nksSisipan;
    }

    public String getPertanyaan1() {
        return pertanyaan1;
    }

    public void setPertanyaan1(String pertanyaan1) {
        this.pertanyaan1 = pertanyaan1;
    }

    public String getPertanyaan3b() {
        return pertanyaan3b;
    }

    public void setPertanyaan3b(String pertanyaan3b) {
        this.pertanyaan3b = pertanyaan3b;
    }

    public B1 getB1() {
        return b1;
    }

    public void setB1(B1 b1) {
        this.b1 = b1;
    }

    public OptionYaTidak getPertanyaan2() {
        return pertanyaan2;
    }

    public void setPertanyaan2(OptionYaTidak pertanyaan2) {
        this.pertanyaan2 = pertanyaan2;
    }

    public OptionPertanyaan3a getPertanyaan3a() {
        return pertanyaan3a;
    }

    public void setPertanyaan3a(OptionPertanyaan3a pertanyaan3a) {
        this.pertanyaan3a = pertanyaan3a;
    }

    public OptionKlasifikasi getKlasifikasi() {
        return klasifikasi;
    }

    public void setKlasifikasi(OptionKlasifikasi klasifikasi) {
        this.klasifikasi = klasifikasi;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (nksSisipan != null ? nksSisipan.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Sisipan)) {
            return false;
        }
        Sisipan other = (Sisipan) object;
        if ((this.nksSisipan == null && other.nksSisipan != null) || (this.nksSisipan != null && !this.nksSisipan.equals(other.nksSisipan))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "sp.model.Sisipan[ nksSisipan=" + nksSisipan + " ]";
    }
    
}
